//: C15:Sizes.cpp
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
// Object sizes vs. virtual funcs
#include <iostream>
using namespace std;

class NoVirtual
{
    int a;
public:
    void x() const {}
    int i() const {
        return 1;
    }
};

class OneVirtual
{
    int a;
public:
    virtual void x() const {}
    int i() const {
        return 1;
    }
};

class TwoVirtuals
{
    int a;
public:
    virtual void x() const {}
    virtual int i() const {
        return 1;
    }
};

int main()
{
    cout << "int: " << sizeof(int) << endl;
    cout << "NoVirtual: "
         << sizeof(NoVirtual) << endl;
    cout << "void* : " << sizeof(void*) << endl;
    cout << "OneVirtual: "
         << sizeof(OneVirtual) << endl;
    cout << "TwoVirtuals: "
         << sizeof(TwoVirtuals) << endl;
} ///:~
